<template>
  <div>
    <MyTree :data="data"></MyTree>
  </div>
</template>

<script>
import { getTreeList } from "./api";
import MyTree from './MyTree.vue'
export default {
  data() {
    return {
      data: []
    }
  },
  components: {
    MyTree
  },
  async mounted() {
    let { data } = await getTreeList();

    // 1. 扁平数据如果变成多层数据 递归数据
    data.parent.forEach(p => p.type = 'parent');
    this.data = [...data.parent, ...data.child];

    
  },
};
</script>

<style>
</style>